// 常用指令： https://zhidao.baidu.com/question/429373992.html
// 连接池：https://www.cnblogs.com/zaifeng0108/p/7226401.html
// 数据库建表原则：https://blog.csdn.net/kenhins/article/details/51084815
const mysql = require('mysql')

const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: 'zt4945327',
  database: 'test'
})

function sql () {
  pool.getConnection((err, connection) => {
    if (err) {
      throw err;
    }
    connection.query("select * from user", (err, rows) => {
      if (err) {
        throw err
      }
      console.log(rows)
    })
    connection.release()
  })
}

module.exports = {
  sql
}